//
//  CopyViewController.m
//  ObjcGo
//
//  Created by eport on 2021/1/29.
//

#import "CopyViewController.h"

@interface CopyViewController ()

@property(nonatomic,strong)NSArray *array;
@property(nonatomic,strong)NSMutableArray *mutaArray;

;
@property(nonatomic,copy)NSMutableArray *mutaArray1;

@end

@implementation CopyViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"深浅拷贝";
    self.view.backgroundColor = [UIColor whiteColor];
    [self fun2];
}

-(void)fun1{
    
    /*
     1.使用strong修饰nsarray,muta赋值给nsarray,值会发生改变
     */
    
    self.mutaArray = [NSMutableArray array];
    [self.mutaArray addObject:@"1"];
    
    self.array = self.mutaArray;
    
    [self.mutaArray addObject:@"2"];
    [self.mutaArray addObject:@"3"];
    [self.mutaArray addObject:@"4"];
    
    NSLog(@"____此时的数组%@",self.array);

    
}


-(void)fun2{
    
    /*
     1.使用copy修饰NSMutableArray,赋值会直接崩溃
     */
    
    self.mutaArray1 = [NSMutableArray array];
    [self.mutaArray1 addObject:@"1"];
    NSLog(@"____此时的数组%@",self.mutaArray1);
    
}



@end
